home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 317 / asmsrc / bignum.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  2.0 KB  |  51 lines

  1. /* bignum.h-arbitrary precision integers */
  2.  
  3. /* Copyright (C) 1987 Free Software Foundation, Inc.
  4.  
  5. This file is part of Gas, the GNU Assembler.
  6.  
  7. The GNU assembler is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY.  No author or distributor
  9. accepts responsibility to anyone for the consequences of using it
  10. or for whether it serves any particular purpose or works at all,
  11. unless he says so in writing.  Refer to the GNU Assembler General
  12. Public License for full details.
  13.  
  14. Everyone is granted permission to copy, modify and redistribute
  15. the GNU Assembler, but only under the conditions described in the
  16. GNU Assembler General Public License.  A copy of this license is
  17. supposed to have been given to you along with the GNU Assembler
  18. so you can know your rights and responsibilities.  It should be
  19. in a file named COPYING.  Among other things, the copyright
  20. notice and this notice must be preserved on all copies.  */
  21.  
  22. /***********************************************************************\
  23. *                                    *
  24. *    Arbitrary-precision integer arithmetic.                *
  25. *    For speed, we work in groups of bits, even though this        *
  26. *    complicates algorithms.                        *
  27. *    Each group of bits is called a 'littlenum'.            *
  28. *    A bunch of littlenums representing a (possibly large)        *
  29. *    integer is called a 'bignum'.                    *
  30. *    Bignums are >= 0.                        *
  31. *                                    *
  32. \***********************************************************************/
  33.  
  34. #define    LITTLENUM_NUMBER_OF_BITS    (16)
  35. #define    LITTLENUM_RADIX            (1 << LITTLENUM_NUMBER_OF_BITS)
  36. #define    LITTLENUM_MASK            (0xFFFF)
  37. #define LITTLENUM_SHIFT            (1)
  38. #define CHARS_PER_LITTLENUM        (1 << LITTLENUM_SHIFT)
  39. #ifndef BITS_PER_CHAR
  40. #define BITS_PER_CHAR            (8)
  41. #endif
  42.  
  43. typedef unsigned short int    LITTLENUM_TYPE;
  44.  
  45.  
  46. /* JF truncated this to get around a problem with GCC */
  47. #define    LOG_TO_BASE_2_OF_10        (3.321928 /* 0948873623478703194294893901758651 */)
  48.                 /* WARNING: I haven't checked that the trailing digits are correct! */
  49.  
  50. /* end: bignum.h */
  51.